<?php

$content = array();
$totalNum = 0;
$maxNum = 0;
$filepath = __DIR__.'/log/pictureCount.log';

if(!file_exists($filepath))
{
    exit("file:{$filepath} not exist".PHP_EOL);
}
$handle = fopen($filepath, 'r');
if(!is_resource($handle))
{
    exit("not resource".PHP_EOL);
}

while (!feof($handle))
{
    $line = trim(fgets($handle));
    list($id, $count) = explode(':', $line);
    $totalNum += $count;
    $maxNum = max($maxNum, $count);
}
fclose($handle);

echo 'total : '.$totalNum.PHP_EOL;
echo 'max : '.$maxNum.PHP_EOL;

